#include "gtd_common.hpp"

NAMESPACE_BEG(gtd)

Error::Error(const std::string& msg, const char* file, int line):
std::runtime_error("GTD Exception: " + msg
                   + "\n   File: \"" + file 
                   + "\"\n   Line: " + toString(line))
{
}

NAMESPACE_END(gtd)

NAMESPACE_BEG(sdl)

Error::Error(const char* msg, const char* code, const char* file, int line):
std::runtime_error(std::string("SDL Exception: ") + msg 
                   + "\n   Code: " + code
                   + "\n   File: \"" + file 
                   + "\"\n   Line: " + toString(line))
{
}

NAMESPACE_END(sdl)


NAMESPACE_BEG(gl)

Error::Error(GLenum status, const char* code, const char* file, int line): 
std::runtime_error(std::string("OpenGL Exception: ") 
                   + (const char*)gluErrorString(status) 
                   + "\n   Code: " + code
                   + "\n   File: \"" + file 
                   + "\"\n   Line: " + toString(line)),
status(status)
{
}

NAMESPACE_END(gl)

NAMESPACE_BEG(cuda)

Error::Error(cudaError_t status, const char* code, const char* file, int line): 
std::runtime_error(std::string("CUDA Exception: ") + cudaGetErrorString(status) 
                   + "\n   Code: " + code
                   + "\n   File: \"" + file 
                   + "\"\n   Line: " + toString(line)),
status(status)
{
}

NAMESPACE_END(cuda)
